package com.hhit.zhgd.dao

import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.hhit.zhgd.domain.entity.ZhgdAlert
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest

@SpringBootTest
class ZhgdAlertMapperTests {
    @Autowired
    private var zhgdAlertMapper: ZhgdAlertMapper? = null

    @Test
    fun getAlert() {
        zhgdAlertMapper?.getAlert()?.forEach { println(it) }
    }

    @Test
    fun getPageAlert() {
        val page = Page<ZhgdAlert>(1, 10)
        val params = HashMap<String,Any?>().also {
            it["start"] = "2023-01-01 00:00:00"
            it["end"] = "2024-07-13 23:59:59"
            it["types"] = listOf(1)
        }

        zhgdAlertMapper?.getPageAlert(page, params)?.records?.forEach { println(it) }
    }

    @Test
    fun countByDescc() {
        zhgdAlertMapper?.countByDescc("2023-01-01 00:00:00", "2024-07-13 00:00:00")?.forEach { println(it) }
    }

    @Test
    fun countByTime() {
        zhgdAlertMapper?.countByTime(HashMap<String,Any?>().also {
            it["period"] = "year"
            it["type"] = 1
        })?.forEach { println(it) }
    }
}